/* SPDX-License-Identifier: Apache-2.0 */

// HIGH LEVEL

html {
  font-size: 100%;

  @media screen and (max-width: $tablet) {
    font-size: 95%;
  }
}

body {
  font-family: $base-font-family;
  font-size: $base-font-size;
  line-height: $base-line-height;
  font-weight: $base-font-weight;
  color: $text-color;
  background-color: $background-color;
  direction: ltr;
}


// CODE

code,
kbd,
pre,
samp,
tt,
.docutils.literal {
  font-family: $code-font;
  background-color: lighten($base-grey, 5);
  border: 1px solid $border-color;
  padding: 0 2px 1px;
  font-size: 0.85rem;
  color: lighten($text-color, 15);
}

// HEADINGS

h1 {
  @include h1;
}

h2 {
  @include h2;
}

h3 {
  @include h3;
}

h4 {
  @include h4;
}

h5 {
  @include h5;
}

h6 {
  @include h6;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  padding-top: $spacing-unit;
}

h1:first-child,
h2:first-child,
h3:first-child,
h4:first-child,
h5:first-child,
h6:first-child,
hr + h1,
hr + h2,
hr + h3,
hr + h4,
hr + h5,
hr + h6 {
  padding-top: 0;
}


// TYPE

strong {
  font-weight: $bold-font-weight;
}

a {
  @include primary-underlined-link;

  // Add 'external link' icon to most external links
  &[target="_blank"]:not(.copy-tooltip, .sponsors__sponsor) {
    &::after {
      white-space: nowrap;
      font-size: 0.8em;
      font-family: "Font Awesome 6 Free";
      font-weight: 900;
      content: "\f35d" #{"/*rtl:remove*/"};
      margin: 0 0 0 4px;
      color: inherit;
      position: relative;
      top: -1px;
    }
  }

  // Add 'email' icon to email links
  &[href^="mailto:"] {
    &::after {
      font-size: 0.9rem;
      font-family: "Font Awesome 6 Free";
      font-weight: 400;
      content: "\f0e0";
      color: inherit;
      /*rtl:ignore*/
      margin: 0 0 0 4px;
      position: relative;
      top: 0.5px;
    }
  }

  code,
  kbd,
  pre,
  samp,
  tt {
    font-size: 0.7rem;
    position: relative;
    top: -2px;
    padding: 0 2px;
  }
}

button {
  @include link-without-underline;
  @include link-focus-state($primary-color);
  line-height: $base-line-height;
}

::selection {
  color: darken($primary-color, 15);
  background: $highlight-color;
}

abbr[title] {
  border-bottom: 0;
  text-decoration: underline dotted;
  cursor: help;
}

// VERTICAL RHYTHM

// Set `padding-bottom` to maintain vertical rhythm
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
ul,
ol,
dl,
figure {
  padding-bottom: $half-spacing-unit;
}

p:last-child,
pre:last-child,
ul:last-child,
ol:last-child,
dl:last-child,
figure:last-child {
  padding-bottom: 0;
}

hr {
  margin: ($spacing-unit * 1.5) 0;
  border: 0;
  height: 2px;
  background: $border-color;
  background-image: linear-gradient(to right, $border-color, $white);
}

// Pre-formatted text
.preserve-line-breaks {
  white-space: pre-line;
}
